package graphics;

import hardware.Display2D;


public class Bitmap2D {

public short data[];
private short viewport[] = new short[4];

public static final int AXIS_X		 = 0; 
public static final int AXIS_Y		 = 1;

private static native void _fill(short[] data,short color);
private static native void _setPixel(int xPos,int yPos,short[] data,short color);
private static native short _getPixel(int xPos,int yPos,short[] data);

//private static native void _display(int xPos,int yPos, short[] data);
//private static native void _display(short []viewport, short[] data);

private static native void _mirror(int axis, short[] data);

private static native void _rotate(int axis, int angle, short[] data);

private static native void _not(short[] data);
private static native void _min(short[] DestinationData,short[] sourceData);
private static native void _max(short[] DestinationData,short[] sourceData);


// to implement
private static native void _copy(short[] data);
private static native void _insert(short[] destination,short[] source);
private static native void _cut(short[] destination,short[] data);

private static native boolean _print8x8Char(short[] data,char index,short color,int x, int y);
private static native boolean _print5x5Char(short[] data,char index,short color,int x, int y);



public Bitmap2D(int xSize, int ySize)
{
	data= new short [(xSize*ySize)+2];
	data[0]=(short)xSize;
	data[1]=(short)ySize;
}




public int getXSize()
{
	return(data[0]);
}


public int getYSize()
{
	return(data[1]);
}

/*
public void display()
{
	_display(viewport,data);

}
*//*
public void display(int xPos, int yPos)
{
	_display(xPos,yPos,data);

}
*/

public static native boolean setPixel(byte xPos,byte yPos,int color);	


public void fill(short color)
{
	_fill(data,color);
}


public void setPixel(int xPos,int yPos,short color)
{
	_setPixel(xPos,yPos,data,color);
}

public short getPixel(int xPos,int yPos)
{
	return(_getPixel(xPos,yPos,data));
}


public void mirror(int axis)
{
	_mirror(axis,data);
}


public void not()
{
	_not(data);
}

public void max(Bitmap2D source)
{
	//return
	_max(data,source.data);
}

public void min(Bitmap2D source)
{
	 _min(data,source.data);
}


public boolean print5x5Char(char index,short color,int x, int y)
{
	return(_print5x5Char(this.data,index,color,x,y));
}


public boolean print8x8Char(char index,short color,int x, int y)
{
	return(_print8x8Char(this.data,index,color,x,y));
}


//public static native void mirror(byte axis);
//public static native void movie(byte xVector,byte yVector,byte zVector);





}
